import type { PageParams, PageResult } from '@/types/global'
import type { BannerItem, GuessItem, HomeItem } from '@/types/home'
import type { CategoryItem } from '@/types/home'
import type { GoodsResult } from '@/types/good'
import { http } from '@/utils/http'

export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

// 热门推荐
export const getHomeHotAPI = () => {
  return http<HomeItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

// 猜你喜欢
export const getGuessAPI = (data?: PageParams) => {
  return http<PageResult<GuessItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}

// 获取商品详情 商品id
export const getGoodsByIdAPI = (id: String) => {
  return http<GoodsResult>({
    method: 'GET',
    url: '/goods',
    data: { id },
  })
}
